var data = {
    labels: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
    datasets: [
        {
            label: "My First dataset",
            fillColor: "rgba(220,220,220,0.2)",
            strokeColor: "rgba(220,220,220,1)",
            pointColor: "rgba(220,220,220,1)",
            pointStrokeColor: "#fff",
            pointHighlightFill: "#fff",
            pointHighlightStroke: "rgba(220,220,220,1)",
            data: [65, 59, 80, 81, 56, 59, 80, 81, 56, 59, 80, 81]
        },
        {
            label: "My Second dataset",
            fillColor: "rgba(151,187,205,0.2)",
            strokeColor: "rgba(151,187,205,1)",
            pointColor: "rgba(151,187,205,1)",
            pointStrokeColor: "#fff",
            pointHighlightFill: "#fff",
            pointHighlightStroke: "rgba(151,187,205,1)",
            data: [28, 48, 40, 63, 56, 59, 52, 41, 19, 86, 59, 19]
        }
    ]
};
var pdata = [
    {
        value: 20,
        color: "#46BFBD",
        highlight: "#5AD3D1",
        label: "已完成"
    },
    {
        value: 50,
        color: "#F7464A",
        highlight: "#FF5A5E",
        label: "开发中"
    },
    {
        value: 68,
        color: "#46B8BD",
        highlight: "#5AD3D1",
        label: "测试中"
    },
    {
        value: 120,
        color: "#F3454B",
        highlight: "#FF5A5E",
        label: "筹备中"
    }
];

var ctxl = $("#lineChartDemo").get(0).getContext("2d");
var lineChart = new Chart(ctxl).Line(data);

var ctxp = $("#pieChartDemo").get(0).getContext("2d");
var pieChart = new Chart(ctxp).Pie(pdata);


var addCount = 0;

function insert_row(tableId) {
    addCount++;
    var elementText = "<label><input class=\"form-control\" name=\"key{0}\" type=\"text\"></label>".signMix(addCount);

    var tbl = document.getElementById(tableId);
    R = tbl.insertRow(); //insertRow() 方法用于在表格中的指定位置插入一个新行。
    C = R.insertCell(); //insertCell() 方法用于在 HTML 表的一行的指定位置插入一个空的 <td> 元素。
    C.innerHTML = "<label><input class=\"form-control\" name=\"key{0}\" type=\"text\"></label>".signMix(addCount);

    C = R.insertCell();
    C.innerHTML = "<label><input class=\"form-control\" name=\"value{0}\" type=\"text\"></label>".signMix(addCount);
    C = R.insertCell();
    C.innerHTML = "<label><input class=\"form-control\" name=\"description{0}\" type=\"text\"></label>".signMix(addCount);
}

function deleteRow(obj) {
    alert("确定删除第" + (obj.parentElement.parentElement.rowIndex + 1) + "行吗？");
    tbl.deleteRow(obj.parentElement.parentElement.rowIndex);
}

